import httpAxios from '@/api/interceptor';
import axios from "axios";
import { 
    DataCommonRes, 
    TaskParams, 
    InItSettingsList, 
    ArListData, 
    ReadParams, 
    ReadResultData, 
    AddAnnoParams,
    AddMaskAnnoParams,
    AddAnnoResult, 
    UpdateAnnoParams,
    UpdateMaskAnnoParams,
    AddCrParams,
    AddCrData,
    UpdateCrParams,
    SaveYaYParams,
    SubmitOverParams,
    CreateVidoeGroupParams,
    CreateVideoGroupResponse,
    UpdatedVideoGroupParams,
    GetVideoInfoResponse,
    ArItem
} from './readPathology.d';

// const preFix = 'test/';
const preFix = '';
// 获取标注序列
export function getAnnoArList(data: TaskParams) {
    return httpAxios.post<ArListData>(preFix + 'anno/result/series/get', data);
}

// 获取基本征象，工具配置
export function getInitSettingData(data: TaskParams) {
    return httpAxios.post<InItSettingsList>(preFix + 'anno/setting/read', data);
}

// 查看征象，工具配置结果
export function getInitResultData(data: ReadParams) {
    return httpAxios.post<ReadResultData>(preFix + 'anno/result/read', data);
}

// 新增保存标注
export function saveAnnoData(data: AddAnnoParams) {
    return axios.post<AddAnnoResult>(preFix + 'anno/lesion/result/point', data);
    // return httpAxios.post<AddAnnoResult>(preFix + 'anno/lesion/result/point', data);
}

// 更新标注
export function updateAnnoData(data: UpdateAnnoParams) {
    return httpAxios.put<DataCommonRes>(preFix + 'anno/lesion/result/point', data);
}
//更新病灶类型
export function updateAnnoType(data: any) {
    return httpAxios.put<DataCommonRes>(preFix + 'anno/lesion/result/lesion/update', data);
}

// 新增保存mask标注
export function saveMaskAnnoData(data: AddMaskAnnoParams) {
    return httpAxios.post<AddAnnoResult>(preFix + 'anno/lesion/result/mask', data);
}

// 更新mask标注
export function updateMaskAnnoData(data: UpdateMaskAnnoParams) {
    return httpAxios.put<DataCommonRes>(preFix + 'anno/lesion/result/mask', data);
}

// 大小征象批量新增
export function saveCrListData(data: AddCrParams) {
    return httpAxios.post<AddCrData>(preFix + 'anno/component/result', data);
}

// 更新大小征象批量
export function updateCrListData(data: UpdateCrParams) {
    return httpAxios.put<DataCommonRes>('anno/component/result', data);
}

// 标注阴阳性
export function saveYaYData(data: SaveYaYParams) {
    return httpAxios.post<DataCommonRes>(preFix + 'anno/result/yay', data);
}

// 标注最终提交
export function submitDataOver(data: SubmitOverParams) {
    return httpAxios.post<DataCommonRes>(preFix + 'anno/result/submit', data);
}

// 删除病灶
export function delLesionData(data: string) {
    return httpAxios.delete<DataCommonRes>(preFix + `/anno/lesion/result/${data}`);
}
//获取dcm路径
export function getSeriesData(model: any, config: any) {
    return httpAxios.post<any>(`/dwh/image/query`, model, config);
}

// 超声视频增加的接口
// 获取视频帧信息
export const getVidoeInfo = (data: Omit<ArItem, 'id'>) => {
    return httpAxios.get<GetVideoInfoResponse>(preFix + `/anno/ultrasound/video/frame/info${data}`)
}
// 创建视频帧段集合
export const createVideoGroup = (data: CreateVidoeGroupParams) => {
    return httpAxios.post<CreateVideoGroupResponse>(preFix + '/anno/lesion/result/group', data)
}

// 更新视频帧段集合
export const updateVideoGroup = (data: UpdatedVideoGroupParams) => {
    return httpAxios.put<DataCommonRes>(preFix + '/anno/lesion/result/group', data)
}

// 删除视频帧段集合
export const delVideoGroup = (data: number) => {
    return httpAxios.delete<DataCommonRes>(preFix + `/anno/lesion/result/group/${data}`)
}

// 超声视频算法追踪
export const getTrace = (data: ReadParams) => {
    return httpAxios.post<DataCommonRes>(preFix + '/anno/ultrasound/video/trace', data)
}